Skip to content

feat(evo-react): Add EvoIcon component#563

Open
HenriqueLimas wants to merge 3 commits intomainfrom
feat/evo-react-icons
Open

feat(evo-react): Add EvoIcon component#563
HenriqueLimas wants to merge 3 commits intomainfrom
feat/evo-react-icons

Conversation

@HenriqueLimas
Copy link
Member

Description

Adds icon system to @evo-web/react with individual subpath exports for optimal tree-shaking and build performance.

  • Generate individual EvoIcon components from @ebay/skin
  • Use package.json wildcard pattern for subpath exports
  • Create EvoIconProvider context for SSR optimization
  • Add build script to auto-generate icons from Skin
  • Configure Vite to build icons as separate entry points
  • Update EvoButton to use EvoIconChevronDown16
  • Export icon utilities from main package entry
  • Create Storybook documentation with usage examples
  • Add ADR 0004 documenting hybrid import path strategy

Screenshots

Checklist

  • I verify all changes are within scope of the linked issue
  • I added/updated/removed testing (Storybook in Skin) coverage as appropriate
  • I tested the UI in all supported browsers
  • I tested the UI in dark mode and RTL mode

@HenriqueLimas HenriqueLimas self-assigned this Mar 12, 2026
Copilot AI review requested due to automatic review settings March 12, 2026 22:24
@changeset-bot
Copy link

changeset-bot bot commented Mar 12, 2026

🦋 Changeset detected

Latest commit: fcc5496

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@evo-web/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new EvoIcon system to @evo-web/react, generating individual icon components and wiring up subpath exports for tree-shaking and SSR-friendly symbol injection.

Changes:

  • Added a large set of auto-generated EvoIcon* React components backed by inline SVG <symbol> definitions.
  • Introduced an EvoIconProvider / IconContext to support symbol management (intended SSR optimization).
  • Updated EvoButton split-button UI to use EvoIconChevronDown16 instead of a text glyph, and updated package export + icon generation scripts.

Reviewed changes

Copilot reviewed 298 out of 1052 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/evo-react/src/evo-icon/icons/*.tsx Adds many auto-generated icon entrypoints that render <EvoIcon ... __symbol={SYMBOL} />.
packages/evo-react/src/evo-icon/context.tsx Introduces a provider/context and a hidden <svg> root for symbol injection.
packages/evo-react/src/evo-button/button.tsx Replaces the temporary glyph with EvoIconChevronDown16 for split buttons.
packages/evo-react/package.json Adds wildcard subpath exports for icons and enables the icon generation script.
package.json Adds vitest-browser-react to the workspace devDependencies.
.changeset/new-feet-open.md Publishes a patch changeset for the new icon components.

import { EvoIcon } from "../icon";
import type { EvoIconComponent } from "./types";

const SYMBOL = `<symbol viewBox="0 0 24 24" id="icon-arrows-expand-16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1 22a1 1 0 0 0 1 1h7a1 1 0 1 0 0-2H4.414l6.293-6.293a1 1 0 0 0-1.414-1.414L3 19.586V15a1 1 0 1 0-2 0v7Zm12.293-11.293a1 1 0 0 0 1.414 0L21 4.414V9a1 1 0 1 0 2 0V2a1 1 0 0 0-1-1h-7a1 1 0 1 0 0 2h4.586l-6.293 6.293a1 1 0 0 0 0 1.414Z"/></symbol>`;
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The evo-icon-arrows-expand-16 symbol uses a viewBox of 0 0 24 24, which does not match the -16 icon size naming. This appears to be the inverse of evo-icon-arrows-expand-24.tsx, reinforcing that the assets were swapped. Regenerate/fix so each file contains the correctly sized symbol data.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +17
import { createContext, type ReactNode } from "react";

export const IconContext = createContext<Set<string> | null>(null);

export const ROOT_ID = "evo-web-svg-symbols";

export const EvoIconProvider = ({ children }: { children: ReactNode }) => (
<IconContext.Provider value={new Set()}>
<svg
id={ROOT_ID}
style={{ position: "absolute", height: "0px", width: "0px" }}
focusable={false}
aria-hidden="true"
/>
{children}
</IconContext.Provider>
);
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating new Set() inline makes the context value change on every provider render, forcing all consumers to re-render and (depending on how symbols are tracked) potentially re-inject symbols repeatedly. Use a stable instance per provider (e.g., store the Set in a useRef or useMemo) so rerenders don’t invalidate the context value.

Suggested change
import { createContext, type ReactNode } from "react";
export const IconContext = createContext<Set<string> | null>(null);
export const ROOT_ID = "evo-web-svg-symbols";
export const EvoIconProvider = ({ children }: { children: ReactNode }) => (
<IconContext.Provider value={new Set()}>
<svg
id={ROOT_ID}
style={{ position: "absolute", height: "0px", width: "0px" }}
focusable={false}
aria-hidden="true"
/>
{children}
</IconContext.Provider>
);
import { createContext, type ReactNode, useRef } from "react";
export const IconContext = createContext<Set<string> | null>(null);
export const ROOT_ID = "evo-web-svg-symbols";
export const EvoIconProvider = ({ children }: { children: ReactNode }) => {
const iconsRef = useRef<Set<string>>(new Set());
return (
<IconContext.Provider value={iconsRef.current}>
<svg
id={ROOT_ID}
style={{ position: "absolute", height: "0px", width: "0px" }}
focusable={false}
aria-hidden="true"
/>
{children}
</IconContext.Provider>
);
};

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will make the change!

HenriqueLimas and others added 3 commits March 13, 2026 11:07
Adds icon system to @evo-web/react with individual subpath exports
for optimal tree-shaking and build performance.

Key changes:
- Generate 1,036 individual EvoIcon components from @eBay/skin
- Use package.json wildcard pattern for subpath exports
- Create EvoIconProvider context for SSR optimization
- Add build script to auto-generate icons from Skin
- Configure Vite to build icons as separate entry points
- Update EvoButton to use EvoIconChevronDown16
- Export icon utilities from main package entry
- Create Storybook documentation with usage examples
- Add ADR 0004 documenting hybrid import path strategy

Architecture:
- Components use unified entry:
  import { EvoButton } from "@evo-web/react"
- Icons use subpaths:
  import { EvoIconCart16 } from "@evo-web/react/evo-icon-cart-16"
- Prevents bundlers from parsing 1,000+ unused icons
- SSR-friendly with fallback lookup and symbol registration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants